<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <!-- <script>

        // Object.prototype.toString = function() {}

        Person.prototype = {//重写toString方法
            toString: function() {
                return 'hehe';
            }
        }
        // 还可以重写Object.prototype.toString来覆盖以前的方法,但不建议修改系统自带的方法
        function Person() {

        }

        var person = new Person();

        console.log(person.toString());
    </script> -->

    <script>

        Number.prototype.toString = function() {
            return '老邓身体好';
        }

        var num = 123;
        console.log(num.toString());// 会调用重写的方法
        document.write(num); //原始值不用调用toString
        document.write(new Number(num));
    </script>
</body>
</html>